<!-- <img src="<?php echo WO_ADMIN_IMAGE . '1.jpg'; ?>"> -->

<?php 

	$aOptions = get_post_meta($post->ID, "tunna_slider", true);


	$atunnaDefault = wp_parse_args($aOptions, array("settings"=>array("title"=> array(""), "img_url"=>array(" "), "description"=>array(""), "span"=>array(""), "link_title"=>array(""), "link_url"=>array("") )) );
?>

<div class="panel-body">

<div class="container-12-fluid sl-hn">
	<div class="container-12-row">
		<div class="large-12">

		</div>
		<div class="large-12">

			<?php 
			foreach ($atunnaDefault['settings']['img_url'] as $k => $v) :
				$v = ltrim($v);
				$title = isset($atunnaDefault['settings']['title'][$k]) ?  stripslashes($atunnaDefault['settings']['title'][$k]) : '';
				$span = isset($atunnaDefault['settings']['span'][$k]) ?  stripslashes($atunnaDefault['settings']['span'][$k]) : '';
				$createTitle = $title . ' ' . $span;
				$checkEmptyTitle = ltrim($createTitle);
				$createTitle = empty($checkEmptyTitle)  ? 'No Title' : $createTitle;
			?>

			<div class="accordion">

				<!-- ccordion-wrap -->
				<div class="accordion-wrap wrap-slide">
					<h3 class="accordion-toggle">
						
						<span><?php echo $createTitle ?></span>
						<a href="#" class="right wo-delete-image" title="Delete layer"><i class="fa fa-times"></i></a>
					</h3>
					<div class="accordion-content">
						<div class="container-12-fluid">
							<div class="large-6">
								<div class="image-wrap">
								<?php if ( !empty($v) ) : ?>
								<img src="<?php echo esc_url($v); ?>">

								<?php else : ?>
								<img src="<?php echo plugin_dir_url(__FILE__) .'assets/images/no-img.jpg'; ?>">
								<?php endif; ?>
								</div>
								<br>
								<a class="btn btn-white upload-img" data-append=".image-wrap" data-insertlink=".wo-insert-link">Get image</a>
							
								<input type="hidden" name="tunna_slider[settings][img_url][]" class="insertlink" value="<?php echo esc_url($v) ;?>">
								
							</div>
							<div class="large-6">
								<!-- Editer -->
								<div class="editer">
									<div class="editor-wrap">

										<div class="edit-wrap">
											<h4 class="editer-title box-first">Caption</h4>
											<div class="editer-content">
												<div class="form-group">
							                        <label class="form-label">Tittle</label>
							                        <div class="controls">
							                          <input type="text" value="<?php echo isset($atunnaDefault['settings']['title'][$k])  ? stripslashes($atunnaDefault['settings']['title'][$k]) : ''; ?>" name="tunna_slider[settings][title][]" class="form-control">
							                        </div>
							                    </div>
							                    <div class="form-group">
							                        <label class="form-label">Highlight</label>
							                        <div class="controls">
							                          <input type="text" name="tunna_slider[settings][span][]" value="<?php echo isset($atunnaDefault['settings']['span'][$k])  ? stripslashes($atunnaDefault['settings']['span'][$k]) : ''; ?>" class="form-control">
							                        </div>
							                    </div>
							                    <div class="form-group">
							                        <label class="form-label">Description</label>
							                        <div class="controls">
							                          <textarea name="tunna_slider[settings][description][]"><?php echo isset($atunnaDefault['settings']['description'][$k])  ? stripslashes($atunnaDefault['settings']['description'][$k]) : ''; ?></textarea>
							                        </div>
							                    </div>
											</div>
										</div> <!-- /edit-wrap -->

										<div class="edit-wrap">
											<h4 class="editer-title box-last">Link</h4>
											<div class="editer-content">
												<div class="form-group">
							                        <label class="form-label">Link tittle</label>
							                        <div class="controls">
							                          <input type="text" name="tunna_slider[settings][link_title][]" value="<?php echo isset($atunnaDefault['settings']['link_title'][$k])  ? stripslashes($atunnaDefault['settings']['link_title'][$k]) : ''; ?>" class="form-control">
							                        </div>
							                    </div>
							                    <div class="form-group">
							                        <label class="form-label">Link url</label>
							                        <div class="controls">
							                          <input type="text" name="tunna_slider[settings][link_url][]" value="<?php echo isset($atunnaDefault['settings']['link_url'][$k])  ? stripslashes($atunnaDefault['settings']['link_url'][$k]) : ''; ?>" class="form-control">
							                        </div>
							                    </div>
											</div>
										</div> <!-- /edit-wrap -->

									</div>
								</div>
							</div>
						</div>
					</div>
					<!-- END -->
				</div> <!-- /ccordion-wrap -->
				
				<!-- ccordion-wrap -->
			</div>

			<?php 
			endforeach;
			?>

			<div class="wo-wrap-add-slider">
				<button class="button wo-add-new">Add new layer</button>
				<span class="spinner" style="display: none;"></span>
			</div>

		</div>

	</div>
</div>

	
   
    
</div>


